package com.kzx2;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Test {

	public static void main(String[] args) {

		//1. 最原始方式
//		ClassPathXmlApplicationContext applicationContext =
//				new ClassPathXmlApplicationContext("spring.xml");

		//2. 注解方式
		AnnotationConfigApplicationContext applicationContext =
				new AnnotationConfigApplicationContext(AppConfig.class);

//		UserService userService = applicationContext.getBean("userService", UserService.class);
//		System.out.println("userService = "+userService);
		System.out.println(applicationContext.getBean("lubanFactoryBean"));
		System.out.println(applicationContext.getBean("lubanFactoryBean"));
		System.out.println(applicationContext.getBean("lubanFactoryBean"));
		System.out.println(applicationContext.getBean("&user"));

//		System.out.println(applicationContext.getBean("appConfig"));

	}

}
